﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using DevExpress.XtraTab;
using DevExpress.XtraTab.ViewInfo;

namespace QLTV.Forms
{
    public partial class frmDanhMuc : DevExpress.XtraEditors.XtraForm
    {
        public frmDanhMuc()
        {
            InitializeComponent();
        }

        private void nbiPhong_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            Forms.KhaiBao.frmPhongNghiepVu f = new Forms.KhaiBao.frmPhongNghiepVu();

            //foreach (XtraTabPage item in MainTab.TabPages)
            //{
            //    if (item.Controls[0].Name == f.Name)
            //    {
            //        MainTab.SelectedTabPage = item;
            //        return;
            //    }
                
            //}

            f.Dock = DockStyle.Fill;
            f.TopLevel = false;
            XtraTabPage tab = new XtraTabPage();
            tab.Text = "Phòng nghiệp vụ";

            tab.Controls.Add(f);
            MainTab.TabPages.Add(tab);
            MainTab.SelectedTabPage = tab;

            

        }

        private void MainTab_CloseButtonClick(object sender, EventArgs e)
        {
            XtraTabControl tabControl = sender as XtraTabControl;
            ClosePageButtonEventArgs arg = e as ClosePageButtonEventArgs;
            MainTab.TabPages.Remove((arg.Page as XtraTabPage));
           // (arg.Page as XtraTabPage).PageVisible = false;
        }

    }
}